#include <iostream>    
#include <list> 
#include <algorithm> 
using namespace std;
/*
Chuong trinh` nham giai? thich' ham` remove() dung` voi' cac' vector,list,deque,...
Tac' dung. cua? ham` nay` ko lam` thay doi? dung luong. cua? list,vector,deque,...

Nhu vi' du. nay` , muc. dich' xoa' cac' nguyen to' co' value = 3 trong list :

No' se~ xoa' cac' nguyen to' co' gia' tri. = 3 di va` don` list lai. , sau do' them cac' nguyen to'
ket' thuc' cuoi' cung` o? list (truoc' khi remove) vao` lap' day` list
**/
int main() { 
	list<int> coll; 
	//insert elements from 6 to 1 and 1 to 6 
	for (int i=1; i<=6; ++i) { 
		coll.push_front(i); 
		coll.push_back(i); 
	} 
	//print all elements of the collection 
	cout << "pre:  "; 
	copy (coll.begin(), coll.end(),               //source 
	ostream_iterator<int> (cout," "));      //destination 
	cout << endl; 
	remove (coll.begin() , coll.end(),3); //remove all elements with value 3 
	//print all elements of the collection 
	cout << "post: "; 
	copy (coll.begin(), coll.end(),              //source 
	ostream_iterator<int> (cout," "));     //destination 
	cout << endl; 
}
/*   
pre:  6 5 4 3 2 1 1 2 3 4 5 6    
post: 6 5 4 2 1 1 2 4 5 6 5 6
**/
